#coding=utf-8
from PublicTool import HttpWrite
from PublicTool.ViewHelper import ViewHelper
import models
from travel.TravelData.models import PositionType



__author__ = 'czq'
class LineView(ViewHelper):
    def __init__(self):
        self.moduleName='TraveRecord'
        self.typeName='line'
    def get_model(self):
        return models.RideLine

    def show_get_dict(self,request,instance):
        posList=models.RidePosition.objects.filter(travelLine=instance).order_by("rank")
        return {'posList':posList}
    def show(self,request,id):
        #return HttpWrite.infoSuccess(len(self.get_model().objects.all()))
        return super(LineView,self).show(request,id)

    def show_map(self,request,id):
        return super(LineView,self).show(request,id,url='show_map')

    def list(self,request):
        return super(LineView,self).list(request)


class PositionView(ViewHelper):
    def __init__(self):
        self.moduleName='TraveRecord'
        self.typeName='position'

    def get_model(self):
        return models.RidePosition


    def show(self,request,id):
        return super(PositionView,self).show(request,id)

